package com.visikard.asynctask;

import android.os.Handler;
import android.os.Message;

import com.visikard.application.UIMessage;
import com.visikard.business.CouponBusManage;
import com.visikard.response.DeleteCouponResponse;

public class DeleteCouponAsyncTask extends BaseTask {

	public static final int POS_ID = 0;

	public DeleteCouponAsyncTask(Handler handler) {
		super(handler);
	}

	public DeleteCouponAsyncTask(Handler handler, boolean isShowProgress) {
		super(handler, isShowProgress);
	}

	@Override
	protected Object doBackgroundWork(Object... params) {

		String id = (String) params[POS_ID];

		CouponBusManage busObj = new CouponBusManage();
		return busObj.deleteCoupon(id);
	}

	@Override
	protected boolean handleResult(Object result) {

		DeleteCouponResponse response = (DeleteCouponResponse) result;
		if (response != null) {
			Message successMsg = new Message();
			successMsg.what = UIMessage.MSG_DELETE_COUPON_FINISH;
			successMsg.obj = result;
			mUIHandler.sendMessage(successMsg);

		}
		return false;
	}

}